//
//  TextViewCell.m
//  QuXiang
//
//  Created by Duncan on 2020/6/30.
//  Copyright © 2020 NanHuaiZi. All rights reserved.
//

#import "TextViewCell.h"

@implementation TextViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        [self.contentView addSubviews:[NSArray arrayWithObjects:self.leftLabel, self.textView, nil]];
        [self masonryLayout];
        self.textView.layer.cornerRadius = kFragmemtFloat(5);
        self.textView.layer.masksToBounds = YES;
    }
    return self;
}

#pragma mark ------- Public Methods -------

#pragma mark ------- Lazy Methods -------

- (void)masonryLayout {
    [self.leftLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.contentView.mas_left).offset(kFragmemtFloat(15));
        make.top.equalTo(self.contentView.mas_top).offset(kFragmemtFloat(15));
        make.width.mas_equalTo(kFragmemtFloat(110));
    }];
    [self.textView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.leftLabel.mas_right);
        make.top.bottom.equalTo(self.contentView);
        make.right.equalTo(self.contentView.mas_right).offset(-kFragmemtFloat(15));
    }];
}

- (UILabel *)leftLabel {
    if (!_leftLabel) {
        _leftLabel = [UILabel initWithTextColor:k_Color_TipColor fontSize:15];
    }
    return _leftLabel;
}

- (UITextView *)textView {
    if (!_textView) {
        _textView = [[UITextView alloc] init];
        _textView.font = kAdaptedFontSize(15);
        _textView.textColor = [UIColor blackColor];
    }
    return _textView;
}

@end
